using System.Data;
using ET;
namespace DAL
{
    public class Bank_DAL
    {
        private readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdBank(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Bank_Search");
        }
        public DataTable BindGirdtb_BankDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Bank_Id", id);
            return cls.GetData("sp_tb_Bank_Detail");
        }
        #endregion

        #region Insert
        public bool InsertBank(Bank_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Bank_Alias", data.Bank_Alias);
            cls.AddParameter("@Bank_Name", data.Bank_Name);
            cls.AddParameter("@Bank_Note", data.Bank_Note);
            cls.AddParameter("@Bank_User_Add", data.Bank_User_Add);
            cls.AddParameter("@Bank_Date_Add", data.Bank_Date_Add);
            cls.AddParameter("@Bank_Computer_Add", data.Bank_Computer_Add);
            return cls.ExecuteNonQuery("sp_tb_Bank_Insert");
        }
        #endregion

        #region Update
        public bool UpdateBank(Bank_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Bank_Id", data.Bank_Id);
            cls.AddParameter("@Bank_Alias", data.Bank_Alias);
            cls.AddParameter("@Bank_Name", data.Bank_Name);
            cls.AddParameter("@Bank_Note", data.Bank_Note);
            cls.AddParameter("@Bank_User_Modify", data.Bank_User_Modify);
            cls.AddParameter("@Bank_Date_Modify", data.Bank_Date_Modify);
            cls.AddParameter("@Bank_Computer_Modify", data.Bank_Computer_Modify);
            return cls.ExecuteNonQuery("sp_tb_Bank_Update");
        }
        #endregion

        #region Delete
        public bool DeleteBank(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Bank_Id", id);
            return cls.ExecuteNonQuery("sp_tb_Bank_Delete");
        }
        #endregion
    }
}